﻿using System;

    class Lines
    {
        static void Main()
        {
            int[] numbers=new int[8];
            int[,] bytes = new int[8, 8];
            int col=0;
            int dot=0;
            int line = 0;
            int size = 0;
            for (byte counter=0; counter < 8; counter++)
            {
                numbers[counter] = int.Parse(Console.ReadLine());
            }
            for (int row = 0; row < 8; row++)
            {
                col = 0;
                while (numbers[row] != 0)
                {

                    if (numbers[row] == 0)
                        break;
                if (numbers[row] % 2 == 1)
                {
                    bytes[row, col] = 1;
                    col++;
                }
                else
                {
                    col++;
                }
                    numbers[row] /= 2;
                
            }

            }
            for (int row = 0; row < 8; row++)
            {

                for (int coll = 0; coll < 8; coll++)
                {

                    
                    if (bytes[row, coll] % 2 == 1)
                    {
                        dot++;
                    }
                    if (bytes[coll, row] % 2 == 0)
                    {
                        dot = 0;
                    }
                    if ((dot == line))
                    {
                        line++;
                    }
                    if ((dot > line))
                    {
                        line=1;
                        size = dot;
                    }
                } 
                
            }
            for (int row = 0; row < 8; row++)
            {

                for (int coll = 0; coll < 8; coll++)
                {


                    if (bytes[coll, row] % 2 == 1)
                    {
                        dot++;
                    }
                    if (bytes[coll, row] % 2 == 0)
                    {
                        dot=0;
                    }
                    if ((dot == line))
                    {
                        line++;
                    }
                    if ((dot > size))
                    {
                        line = 1;
                        size = dot;
                    }
                }

            }

            Console.WriteLine(size);
            Console.WriteLine(line);
        }
    }

